package edu.udlap.spring2008.is300.finalexam.app.mvc.model.database.filters;

import edu.udlap.spring2008.is300.finalexam.framework.mvc.model.database.filters.ImageRecordFilter;
import edu.udlap.spring2008.is300.finalexam.framework.mvc.model.database.filters.ImageRecordFilterDecorator;

/**
 *
 * @author Ruslán Ledesma Garza
 */
public class AppImageRecordFilterFavorite extends ImageRecordFilterDecorator
{   
    
    public AppImageRecordFilterFavorite(ImageRecordFilter imageRecordFilter,
            boolean isFavorite, boolean isNegated)
    {
        decoratedImageRecordFilter_ = imageRecordFilter;
        filterValue_ = new Boolean(isFavorite);
        isNegated_ = isNegated;
    }

    @Override
    protected String getSqlConstraints_()
    {
        return "\"IS_FAVORITE\" " + (isNegated_ ? "!" : "") +
                "= " + (((Boolean)filterValue_).booleanValue() ? 1 : 0);
    }
    
}
